package com.maochd.cloud.common.datasource.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.maochd.cloud.common.datasource.annotation.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * <p>基础实体类</p>
 *
 * @author maochd
 * @since 2023/6/6 9:40
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "基础实体类", description = "基础实体类")
public class BaseEntity implements Serializable {

    @ApiModelProperty(value = "ID")
    @NotNull(message = "主键不能为空", groups = Update.class)
    @TableId(value = "`id`", type = IdType.ASSIGN_ID)
    private Long id;

    @ApiModelProperty(value = "行是否有效(0否1是)")
    @TableField("`active`")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Boolean active;
}
